﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizzCore;

namespace BizzUI.Forms
{
    public partial class MessageAttributesForm : Form
    {
        public MessageAttributesForm(string title, Object attributes, string[] headers)
        {
            InitializeComponent();
            this.Text = title;
            initDataGrid(attributes, headers);
        }

        private void initDataGrid(Object attributes, string[] headers)
        {
            dgAttributes.DataSource = attributes;
            dgAttributes.RowHeadersVisible = false;
            dgAttributes.Dock = DockStyle.Fill;
            dgAttributes.Columns[0].Visible = false;
            for (int i = 1; i <= headers.Length; i++)
            {
                dgAttributes.Columns[i].HeaderText = headers[i-1];
                dgAttributes.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            }
            dgAttributes.Columns[headers.Length].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

        }
    }
}
